<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8" />
	<link rel="shortcut icon" href="/assets/favicon.ico">
	<link rel="stylesheet" href="/dist/github-markdown.css" />
	<!-- <link rel="stylesheet" href="/dist/code-atom-dark.css" /> -->
	<script src="/dist/markdown-it.min.js"></script>
	<script src="/dist/highlight.min.js"></script>
	<title>Toringo blog</title>
	<style>
		* {
			transition: color 0.3s ease-in-out;
			transition: background 0.2s ease;
		}

		.mode-select {
			float: right;
		}
	</style>
</head>

<body>
	<header>
		<label class="mode-select">暗黑模式<input type="checkbox" value="0" class="switch_mode" data-label="暗黑模式" /></label>
	</header>

	<article class="markdown-body">
		<div class="md_render">
		</div>
	</article>


	<script>
		let md;
		const defaults = {
			html: false, // Enable HTML tags in source
			xhtmlOut: false, // Use '/' to close single tags (<br />)
			breaks: false, // Convert '\n' in paragraphs into <br>
			langPrefix: 'language-', // CSS language prefix for fenced blocks
			linkify: true, // autoconvert URL-like texts to links
			typographer: true, // Enable smartypants and other sweet transforms
			// options below are for demo only
			// _highlight: true,
			// _strict: false,
			// _view: 'html' // html / src / debug
		};


		defaults.highlight = function (str, lang) {
			const esc = md.utils.escapeHtml;
			if (lang && hljs.getLanguage(lang)) {
				try {
					return '<pre class="hljs"><code>' +
						hljs.highlight(str, { language: lang, ignoreIllegals: true }).value +
						'</code></pre>';
				} catch (__) { }
			} else {
				return '<pre class="hljs"><code>' + esc(str) + '</code></pre>';
			}

		};


		md = window.markdownit(defaults);
		fetch('/md/SingletonPattern.md').then(res => {
			res.text().then(text => {
				const md_render = document.querySelector('.md_render');
				md_render.innerHTML = md.render(text);
			})
		})
	</script>

	<script src="/script/mode.js"></script>
</body>

</html>